<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: SysAnalog    (System Analog Reference Block)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sysanalog.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">SysAnalog (System Analog Reference Block)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>This driver provides an interface for configuring the Analog Reference (AREF), Low Power Oscillator (LpOsc), Deep Sleep Clock and Timer blocks and querying the INTR_CAUSE register of the Programmable Analog SubSystem (PASS) hardware block. </p>
<p>The functions and other declarations used in this driver are in cy_sysanalog.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<h1><a class="anchor" id="group_pass_structure"></a>
PASS block structure</h1>
<div class="image">
<img src="passv2_diagram.png" alt="passv2_diagram.png"/>
</div>
 <p>The Programmable Analog SubSystem (PASS) hardware block contains a set of analog subblocks such as AREF, CTB, SAR, analog routing switches and others. In order to provide a firmware interface to PASS, subblocks are united into groups, which have their own drivers: SysAnalog, <a class="el" href="group__group__ctb.html">CTB</a> and <a class="el" href="group__group__sar.html">SAR</a>.</p>
<h1><a class="anchor" id="group_sysanalog_features"></a>
SysAnalog Features Description</h1>
<p>SysAnalog driver includes the following features:</p><ul>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_aref">AREF</a></li>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_lposc">Low Power Oscillator</a> (Available only for PASS_ver2.)</li>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_dpslp">Deep Sleep Clock</a> (Available only for PASS_ver2.)</li>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_timer">Timer</a> (Available only for PASS_ver2.)</li>
</ul>
<p>The following sections describe how to initialize driver features:</p><ul>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_aref_usage_init">AREF Configuration</a></li>
<li><a class="el" href="group__group__sysanalog.html#group_sysanalog_deepsleepinit">Low Power Oscillator, Deep Sleep Clock and Timer Configuration</a></li>
</ul>
<h1><a class="anchor" id="group_sysanalog_aref"></a>
AREF</h1>
<p>The AREF block has the following features:</p>
<ul>
<li>Generates a voltage reference (VREF) from one of three sources:<ul>
<li>Local 1.2 V reference (<b>low noise, optimized for analog performance</b>)</li>
<li>Reference from the SRSS (high noise, not recommended for analog performance)</li>
<li>An external pin</li>
</ul>
</li>
<li>Generates a 1 uA "zero dependency to absolute temperature" (IZTAT) current reference that is independent of temperature variations. It can come from one of two sources:<ul>
<li>Local reference (<b>low noise, optimized for analog performance</b>)</li>
<li>Reference from the SRSS (high noise, not recommended for analog performance)</li>
</ul>
</li>
<li>Generates a "proportional to absolute temperature" (IPTAT) current reference</li>
<li>Option to enable local references in Deep Sleep mode</li>
</ul>
<p>The locally generated references are the recommended sources for blocks in the PASS because they have tighter accuracy, temperature stability, and lower noise than the SRSS references. The SRSS references can be used to save power if the low accuracy and higher noise can be tolerated.</p>
<div class="image">
<img src="aref_block_diagram.png" alt="aref_block_diagram.png"/>
</div>
 <p>The outputs of the AREF are consumed by multiple blocks in the PASS and by the CapSense (CSDv2) block. In some cases, these blocks have the option of using the references from the AREF. This selection would be in the respective drivers for these blocks. In some cases, these blocks require the references from the AREF to function.</p>
<table class="doxtable">
<tr>
<th>AREF Output</th><th><a class="el" href="group__group__sar.html">SAR</a></th><th><a class="el" href="group__group__ctdac.html">CTDAC</a></th><th><a class="el" href="group__group__ctb.html">CTB</a></th><th>CSDv2 </th></tr>
<tr>
<td>VREF </td><td>optional </td><td>optional </td><td>&ndash; </td><td>optional  </td></tr>
<tr>
<td>IZTAT </td><td><b>required</b> </td><td>&ndash; </td><td>optional </td><td>optional  </td></tr>
<tr>
<td>IPTAT </td><td>&ndash; </td><td>&ndash; </td><td><b>required</b> </td><td>&ndash;  </td></tr>
</table>
<p>This driver provides a function to query the INTR_CAUSE register of the PASS. There are two interrupts in the PASS:</p>
<ol type="1">
<li>one global interrupt for all CTBs (up to 4)</li>
<li>one global interrupt for all CTDACs (up to 4)</li>
</ol>
<p>Because the interrupts are global, the INTR_CAUSE register is needed to query which hardware instance triggered the interrupt.</p>
<h2><a class="anchor" id="group_sysanalog_aref_usage_init"></a>
AREF Configuration</h2>
<p>To configure the AREF, call <a class="el" href="group__group__sysanalog__functions.html#gacef4e5ae550518abd0004e46e5ec4d64">Cy_SysAnalog_Init</a> and provide a pointer to the configuration structure, <a class="el" href="structcy__stc__sysanalog__config__t.html">cy_stc_sysanalog_config_t</a>. Three predefined structures are provided in this driver to cover a majority of use cases:</p>
<ul>
<li><a class="el" href="group__group__sysanalog__globals.html#ga85e9e1cd8c1e6fe581043cbab3083017">Cy_SysAnalog_Fast_Local</a> <b>(recommended for analog performance)</b></li>
<li><a class="el" href="group__group__sysanalog__globals.html#gaf0a91cc831b1e5b70b8c4327a571d4b4">Cy_SysAnalog_Fast_SRSS</a></li>
<li><a class="el" href="group__group__sysanalog__globals.html#ga2bed42fba0641096ff28cdb776eb1548">Cy_SysAnalog_Fast_External</a></li>
</ul>
<p>After initialization, call <a class="el" href="group__group__sysanalog__functions.html#ga153249c7b4cea72ee334ae877a211169">Cy_SysAnalog_Enable</a> to enable the hardware.</p>
<h3>Deep Sleep Operation</h3>
<p>The AREF current and voltage references can be enabled to operate in Deep Sleep mode with <a class="el" href="group__group__sysanalog__functions.html#ga5d6d537beaf82fddf8e06f30b1d308b3">Cy_SysAnalog_SetDeepSleepMode</a>. There are four options for Deep Sleep operation:</p>
<ul>
<li><a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12a00f19ce656942fbb30c5cff00c891dc6">CY_SYSANALOG_DEEPSLEEP_DISABLE</a> : Disable AREF IP block</li>
<li><a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12a040af8630904ae7b6e969a18c2712a70">CY_SYSANALOG_DEEPSLEEP_IPTAT_1</a> : Enable IPTAT generator for fast wakeup from Deep Sleep mode. IPTAT outputs for CTBs are disabled.</li>
<li><a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12ac3b1263aa8889f21a72a8ec9d21066b2">CY_SYSANALOG_DEEPSLEEP_IPTAT_2</a> : Enable IPTAT generator and IPTAT outputs for CTB</li>
<li><a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12aaf8feaa23b7bbbdaba3981fa7e9a64de">CY_SYSANALOG_DEEPSLEEP_IPTAT_IZTAT_VREF</a> : Enable all generators and outputs: IPTAT, IZTAT, and VREF</li>
</ul>
<p>Recall that the CTB requires the IPTAT reference. For the CTB to operate at the 1 uA current mode in Deep Sleep mode, the AREF must be enabled for <a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12aaf8feaa23b7bbbdaba3981fa7e9a64de">CY_SYSANALOG_DEEPSLEEP_IPTAT_IZTAT_VREF</a>. For the CTB to operate at the 100 nA current mode in Deep Sleep mode, the AREF must be enabled for <a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12ac3b1263aa8889f21a72a8ec9d21066b2">CY_SYSANALOG_DEEPSLEEP_IPTAT_2</a> minimum. In this lower current mode, the AREF IPTAT must be redirected to the CTB IZTAT. See the high level function <a class="el" href="group__group__ctb__functions__aref.html#ga5a5dfa4b6150d4ba15f05a5c5ccdcaae">Cy_CTB_SetCurrentMode</a> in the CTB PDL driver.</p>
<p>If the CTDAC is configured to use the VREF in Deep Sleep mode, the AREF must be enabled for <a class="el" href="group__group__sysanalog__enums.html#gga0aadb061d882d9a964dff3729322cf12aaf8feaa23b7bbbdaba3981fa7e9a64de">CY_SYSANALOG_DEEPSLEEP_IPTAT_IZTAT_VREF</a>.</p>
<dl class="section note"><dt>Note</dt><dd>The SRSS references are not available to the AREF in Deep Sleep mode. When operating in Deep Sleep mode, the local or external references must be selected.</dd></dl>
<h1><a class="anchor" id="group_sysanalog_lposc"></a>
Low Power Oscillator</h1>
<p>Features:</p><ul>
<li>Internal PASS_ver2 8MHz oscillator which does not require any external components.</li>
<li>Can work in Deep Sleep power mode.</li>
<li>Can be used as a clock source for the Deep Sleep Clock.</li>
</ul>
<p>Low Power Oscillator clocking mode is configured by <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html#a0b1fec83f438609ac1e1b5389d597aaf" title="Low Power Oscillator Deep Sleep mode. ">cy_stc_sysanalog_deep_sleep_config_t::lpOscDsMode</a> configuration structure item, which should be passed as a parameter to <a class="el" href="group__group__sysanalog__functions.html#gac8a45068447851d1617d8c9885907fc4">Cy_SysAnalog_DeepSleepInit</a> function. See <a class="el" href="group__group__sysanalog__functions__lposc.html">Low Power Oscillator Functions</a> for other Low Power Oscillator control functions.</p>
<h1><a class="anchor" id="group_sysanalog_dpslp"></a>
Deep Sleep Clock</h1>
<p>Features:</p><ul>
<li>Internal PASS_ver2 deep sleep capable clock selector/divider</li>
<li>Can be used as clock source for CTB pump, SAR ADC and Timer</li>
</ul>
<p>Deep Sleep clock is configurable by <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html#aaf94b94ad68f0a10ba67ac54f374ab6e" title="Deep Sleep Clock source select. ">cy_stc_sysanalog_deep_sleep_config_t::dsClkSource</a> and <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html#adbd49c009abf856cd0c271a87f0d2004" title="Deep Sleep Clock divider. ">cy_stc_sysanalog_deep_sleep_config_t::dsClkdivider</a> configuration structure items, which should be passed as a parameter to <a class="el" href="group__group__sysanalog__functions.html#gac8a45068447851d1617d8c9885907fc4">Cy_SysAnalog_DeepSleepInit</a> function.</p>
<h1><a class="anchor" id="group_sysanalog_timer"></a>
Timer</h1>
<p>Features:</p><ul>
<li>Internal PASS_ver2 16-bit down counting timer</li>
<li>Can be used to trigger one or few SAR ADCs</li>
<li>Can be clocked from<ul>
<li>Peripheral Clock (CLK_PERI),</li>
<li>Low Frequency Clock (CLK_LF)</li>
<li>Deep Sleep Clock</li>
</ul>
</li>
<li>If clocked from Deep Sleep Clock, timer can be used to trigger SAR ADC scans in Deep Sleep power mode.</li>
</ul>
<p>Timer is configurable by <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html#ac4a80761e972ea11cf8ddeab9c4c4de0" title="Timer Clock source select. ">cy_stc_sysanalog_deep_sleep_config_t::timerClock</a> and <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html#a032102087dcc28d995a76f1284dadc41" title="Timer period. ">cy_stc_sysanalog_deep_sleep_config_t::timerPeriod</a> configuration structure items, which should be passed as a parameter to <a class="el" href="group__group__sysanalog__functions.html#gac8a45068447851d1617d8c9885907fc4">Cy_SysAnalog_DeepSleepInit</a> function. Also see <a class="el" href="group__group__sysanalog__functions__timer.html">Timer Functions</a> for other Timer configuration and control functions.</p>
<h1><a class="anchor" id="group_sysanalog_deepsleepinit"></a>
Low Power Oscillator, Deep Sleep Clock and Timer Configuration</h1>
<p>To configure Low Power Oscillator, Deep Sleep Clock and Timer blocks, call <a class="el" href="group__group__sysanalog__functions.html#gac8a45068447851d1617d8c9885907fc4">Cy_SysAnalog_DeepSleepInit</a> function and provide pointer to PASS block and pointer to the <a class="el" href="structcy__stc__sysanalog__deep__sleep__config__t.html">cy_stc_sysanalog_deep_sleep_config_t</a> configuration structure. In order to start Low Power Oscillator and Timer, call corresponding enable functions:</p>
<div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Initializes Deep Sleep features */</span></div><div class="line">    <span class="keyword">const</span> <a class="code" href="structcy__stc__sysanalog__deep__sleep__config__t.html">cy_stc_sysanalog_deep_sleep_config_t</a> dsConfig =</div><div class="line">    {</div><div class="line">        <span class="comment">/*.lpOscDsMode  */</span> <a class="code" href="group__group__sysanalog__enums.html#gga8d5d1c61a078ccf107fce8277b39a11ba055b5278d95fda347a979db2e8142874">CY_SYSANALOG_LPOSC_ALWAYS_ON</a>,</div><div class="line">        <span class="comment">/*.dsClkSource  */</span> <a class="code" href="group__group__sysanalog__enums.html#gga159a193656bc75a45b4603982958f88ca1ce12564833d4ba46ae1002636606f95">CY_SYSANALOG_DEEPSLEEP_SRC_LPOSC</a>,</div><div class="line">        <span class="comment">/*.dsClkdivider */</span> <a class="code" href="group__group__sysanalog__enums.html#ggafaf730c28e19936cce24c04d525e4c31acf90874d98cfb188109055e8dbcc371e">CY_SYSANALOG_DEEPSLEEP_CLK_DIV_BY_4</a>,</div><div class="line">        <span class="comment">/*.timerClock   */</span> <a class="code" href="group__group__sysanalog__enums.html#gga608d2bbfed03023ee844347f7c339f4ea4c248c2a2bc423c7b3795a96b5c05971">CY_SYSANALOG_TIMER_CLK_DEEPSLEEP</a>,</div><div class="line">        <span class="comment">/*.timerPeriod  */</span> 4000UL</div><div class="line">    };</div><div class="line">    </div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__sysanalog__enums.html#gga31d179a49097fe5a8b2e8863adba59f4a3ce48673d93f32086ce3b8525c1d5581">CY_SYSANALOG_SUCCESS</a> == <a class="code" href="group__group__sysanalog__functions.html#gac8a45068447851d1617d8c9885907fc4">Cy_SysAnalog_DeepSleepInit</a>(PASS, &amp;dsConfig))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Enable LpOsc and Timer blocks. */</span></div><div class="line">        <a class="code" href="group__group__sysanalog__functions__lposc.html#ga3d570989fa28e6a4e86ae51970930f6c">Cy_SysAnalog_LpOscEnable</a>(PASS);</div><div class="line">        <a class="code" href="group__group__sysanalog__functions__timer.html#gabf1f6993d098242c63769608a1e236f7">Cy_SysAnalog_TimerEnable</a>(PASS);</div><div class="line">    }</div></div><!-- fragment --> <h1><a class="anchor" id="group_sysanalog_more_information"></a>
More Information</h1>
<p>For more information on the AREF, Deep Sleep Clock and Timer, refer to the technical reference manual (TRM).</p>
<h1><a class="anchor" id="group_sysanalog_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td>2.10 </td><td>The CY_SYSANALOG_STARTUP_NORMAL and Cy_SysAnalog_SetArefMode are deprecated. The HW is anyways initialized with the CY_SYSANALOG_STARTUP_FAST. </td><td>User experience enhancement.  </td></tr>
<tr>
<td>2.0 </td><td>Added new features: LPOSC, DSCLK, TIMER. </td><td>New silicon family support.  </td></tr>
<tr>
<td>1.10.1 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td rowspan="2">1.10 </td><td>Flattened the organization of the driver source code into the single source directory and the single include directory.  </td><td>Driver library directory-structure simplification.  </td></tr>
<tr>
<td>Added register access layer. Use register access macros instead of direct register access using dereferenced pointers. </td><td>Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.  </td></tr>
<tr>
<td>1.0 </td><td>Initial version </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__sysanalog__macros"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysanalog__macros.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysanalog__functions"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysanalog__functions.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysanalog__globals"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysanalog__globals.html">Global Variables</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysanalog__data__structures"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysanalog__data__structures.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__sysanalog__enums"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysanalog__enums.html">Enumerated Types</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
